using System;
using System.Collections.Generic;
using System.Linq;
namespace WebClient.Controllers
{
	#region using
	using System.Web.Mvc;
	using WebClient.Models.ViewModels;
	using WebClient.Models;
	using WebClient.Models.Repositories;
	using WebClient.Helpers;
	using System.Web.Security;
	#endregion
    [AdminAuthorize]
	public partial class AdminController: BaseController
	{
		public ActionResult Index()
		{
            var role = LookRole();
            if (role == "ADMIN")
            {
                return RedirectToAction("SelectCity");
            }
            else if (role == "MANAGER")
            {
                var user = _repUsers.SelectByUserName(LookCookie());
                var restaurant = _repRestaurant.SelectAll().FirstOrDefault(n => n.IDManager == user.ID);
                return RedirectToAction("DetailOfRestaurant", new { id = restaurant.ID });
            }
            return null;
		}

	}
}